/**
 * 
 */
package name.marz.to.go.btree.ui.swing;

import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 * @author masaru-gotou
 *
 */
public class ControlPanel extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private InsertControlPanel insertPanel;
	private SelectControlPanel selectPanel;
	private DeleteControlPanel deletePanel;
	private InitializeControlPanel initPanel;
	private SnapControlPanel snapPanel;

	public ControlPanel() {
		setLayout(new GridLayout(0,1));
		initPanel = new InitializeControlPanel();
		insertPanel = new InsertControlPanel();
		selectPanel = new SelectControlPanel();
		deletePanel = new DeleteControlPanel();
		snapPanel = new SnapControlPanel();
		initPanel.setBorder(BorderFactory.createTitledBorder("Initialize Tree"));
		insertPanel.setBorder(BorderFactory.createTitledBorder("Insert"));
		selectPanel.setBorder(BorderFactory.createTitledBorder("Select"));
		deletePanel.setBorder(BorderFactory.createTitledBorder("Delete"));
		snapPanel.setBorder(BorderFactory.createTitledBorder("Snapshot"));
		add(initPanel);
		add(insertPanel);
		add(selectPanel);
		add(deletePanel);
		add(snapPanel);
		deletePanel.setEnabled(false);
	}
	
	public InsertControlPanel getInsertPanel() {
		return insertPanel;
	}
	public SelectControlPanel getSelectPanel() {
		return selectPanel;
	}
	public DeleteControlPanel getDeletePanel() {
		return deletePanel;
	}
	public InitializeControlPanel getInitPanel() {
		return initPanel;
	}
	public SnapControlPanel getSnapPanel() {
		return snapPanel;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                //Create and set up the window.
                JFrame frame = new JFrame("ControlPanel Test");
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                //Create and set up the content pane.
                final ControlPanel panel = new ControlPanel();
                panel.setOpaque(true);
                frame.setContentPane(panel);
                
                //Display the window.
                frame.pack();
                frame.setVisible(true);
            }
        });
	}

}
